﻿
using Irony.Compiler;

namespace IronLua.Ast {

	public class ExpressionStatement : Statement {

		readonly Expression expression;

		public Expression Expression {
			get { return expression; }
		}

		public override LuaNodeType NodeType {
			get { return LuaNodeType.ExpressionStatement; }
		}

		public ExpressionStatement (CompilerContext context, NonTerminal nonTerminal, SourceLocation location, AstNodeList childNodes)
			: base (context, nonTerminal, location, childNodes)
		{
		}

		public ExpressionStatement (Expression expression)
			: base (null, expression.Element as NonTerminal, expression.Location, new AstNodeList ())
		{
			this.expression = expression;
		}

		public override void Accept (ILuaAstVisitor visitor)
		{
			visitor.VisitExpressionStatement (this);
		}
	}
}
